package com.kfm.pm;

public class LazySingleton {

    private static LazySingleton instance;

    private LazySingleton() {
        System.out.println("创建对象");
    }

    public static LazySingleton getInstance() {
        if (instance == null) {
            instance = new LazySingleton();
        }
        return instance;
    }
}

class  LazyTest02 {

    public static void main(String[] args) {
        LazySingleton instance = LazySingleton.getInstance();
        LazySingleton instance1 = LazySingleton.getInstance();
        System.out.println(instance == instance1);
    }
}
